﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace SalomonWebsite.UC
{
    public partial class Foot : System.Web.UI.UserControl
    {
        private string strCon = Global.Connection;
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                //About Salomon
                GetAboutUsList(strCon);
                //Find Salomon on
                GetLinkList(strCon);
            }
        }

        //About Salomon
        protected void GetAboutUsList(string strCon) 
        {
            DataTable dtAboutUs = Bll.Notes.MULTIPLE(strCon);
            if (dtAboutUs != null && dtAboutUs.Rows.Count > 0)
            {
                DataRow[] drs = dtAboutUs.Select(" [IsDisplay] = 1 AND [IsFoot] = 1");
                DataTable dt = dtAboutUs.Clone();

                foreach (DataRow dr in drs)
                {

                    dt.ImportRow(dr);

                }

                this.repAboutUs.DataSource = dt.DefaultView;
                this.repAboutUs.DataBind();
                dtAboutUs.Dispose();
                dt.Dispose();
            }
        }

        //Find Salomon on
        protected void GetLinkList(string strCon) 
        {
            DataTable dtLinks = Bll.Link.MULTIPLE(strCon);
            if (dtLinks != null && dtLinks.Rows.Count > 0) 
            {
                this.repLinks.DataSource = dtLinks.DefaultView;
                this.repLinks.DataBind();
                dtLinks.Dispose();
            }
        }
    }
}